package com.lizemin.jingdongmall.controller;

import com.lizemin.mybatis.config.DataSourceProperties;
import com.lizemin.mybatis.util.SpringContainer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

/**
 * @author lzm
 * @date 2025/5/22 20:30
 * @description
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private SpringContainer springContainer;

    @GetMapping("/getBean")
    public void getBean() {
        DataSource dataSource = springContainer.getBean(DataSource.class);
        DataSourceProperties dataSourceProperties = springContainer.getBean(DataSourceProperties.class);
        System.out.println(dataSourceProperties);
        System.out.println(dataSource);
    }
}
